Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tiny improvements of Range for X19 #2272

Closed
wants to merge 2 commits into from

Conversation

kachick
Copy link
Member

@kachick kachick commented Apr 12, 2013

No description provided.

@@ -1,6 +1,7 @@
# -*- encoding: us-ascii -*-

class Range
# Don't use `alias_method` for #===. `Delegate to #include?` is a spec.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this is defined as the spec, we should also add a RubySpec for this behavior

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry spec is range/case_compare_spec.
But I want to this comment to here for readability.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, sorry from my side, I didn't realize it was just adding this as a comment and not changing the actual code. Were you surprised by this behavior? Behavior like this exists is various other places in Ruby and we don't have comments in all the other places. The upside of actually having a spec for this, is that even if people would think about changing it, the spec would fail and would tell people exactly what is wrong. So I don't really see a big advantage of adding this comment here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I was very surprised this behavior :)
And i was helped by a coment from non updated version guard in spec

But this is my problem, you are right !

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, adding comments like this is often a balancing act. Since the case of a certain being implement with another and not an alias happens in a few more places, it's not that much an edge case as probably the case you mentioned. I remember fixing 17e1e62, but didn't add a comment for that case either.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great reference! Thanks!

@kachick kachick closed this Apr 12, 2013
kachick added a commit to kachick/rubinius that referenced this pull request Apr 12, 2013
Prefer protected to private
--------------------------------------

* This method is just used by `self.each`.

Replace receiver for X19
------------------------

* `first` is gotten the `self.each`

refer
-----

  * rubinius#2272
  * rubinius#2272
kachick added a commit to kachick/rubinius that referenced this pull request Apr 12, 2013
Prefer protected to private
--------------------------------------

* This method is just used by `self.each`.

Replace receiver for X19
------------------------

* `first` is gotten the `self.each`

refer
-----

  * rubinius#2272 (diff)
  * rubinius#2272
kachick added a commit to kachick/rubinius that referenced this pull request Apr 12, 2013
Prefer protected to private
--------------------------------------

* This method is just used by `self.each`.

Replace receiver for X19
------------------------

* `first` is gotten the `self.each`

refer
-----

  * rubinius#2272 (diff)
  * rubinius#2272
@kachick kachick deleted the improve-range-inner_code branch April 17, 2013 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants